package com.njtoyo.taxi.admin.mapper.master.mapper;

import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.njtoyo.taxi.admin.library.Const;
import com.njtoyo.taxi.admin.mapper.master.entity.Coupon;
import com.njtoyo.taxi.admin.rest.presenter.data.allowance.CustomerTotalPresenter;
import com.njtoyo.taxi.admin.rest.presenter.finance.vo.FinanceAllowanceStatsAmountVo;
import com.njtoyo.taxi.admin.rest.presenter.finance.vo.FinanceAllowanceStatsCountVo;
import com.njtoyo.taxi.admin.rest.presenter.marketing.coupon.CouponHotListPresenter;
import com.njtoyo.taxi.admin.rest.wrapper.marketing.coupon.CouponHotQueryWrapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * <p>
 * Mapper 接口
 * </p>
 *
 * @author Dell
 * @since 2021-07-26
 */
@Repository
@DS(Const.PRIMARY_DS)
public interface CouponMapper extends BaseMapper<Coupon> {
    // 0:reduction(减免)
    CustomerTotalPresenter selectTotalAllowanceForReduction(@Param("startTime") String startTime, @Param("endTime") String endTime);

    // 1:discount(折扣)
    CustomerTotalPresenter selectTotalAllowanceForDiscount(@Param("startTime") String startTime, @Param("endTime") String endTime);

    // 已使用
    CustomerTotalPresenter selectAllowanceForHadUsed(@Param("startTime") String startTime, @Param("endTime") String endTime);

    // 0:乘客推广-reduction(减免)
    CustomerTotalPresenter selectRecommendationAllowanceForReduction(@Param("startTime") String startTime, @Param("endTime") String endTime);

    // 1:乘客推广-discount(折扣)
    CustomerTotalPresenter selectRecommendationAllowanceForDiscount(@Param("startTime") String startTime, @Param("endTime") String endTime);

    Integer batchCreate(@Param("list") List<Coupon> list);

    Page<CouponHotListPresenter> selectPageByCustomerId(@Param("customerId") Long customerId, @Param("ew") CouponHotQueryWrapper wrapper);

    List<FinanceAllowanceStatsAmountVo> selectCouponDeductedAmount(@Param("startTimeStamp") Integer startTimeStamp, @Param("endTimeStamp") Integer endTimeStamp);

    List<FinanceAllowanceStatsCountVo> selectCouponUsed(@Param("startTimeStamp") Integer startTimeStamp, @Param("endTimeStamp") Integer endTimeStamp);

}
